home *** CD-ROM | disk | FTP | other *** search
/ 8bitfiles.net/archives / archives.tar / archives / compuserve-file-archive / 22 Graphics & Utilities / DECODE.TXT < prev    next >
Encoding:
Text File  |  2019-04-13  |  6.2 KB  |  134 lines

  1.                         An Overview - Decoding and Displaying
  2.                         RLE Hi-Res Encoded Data Files.
  3.                              By Chrisdos. Cbig Sig Sysop
  4.  
  5.  
  6.         This file will help the basic programmer in writing a program that
  7. will translate the captured data for a RLE (Run Lenght Encoded) picture.
  8.  
  9.         The computer that this is used on should be able to do the following:
  10.                 1) Be able to log into CIS and RAM BUFFER capture data online.
  11.                 2) Be able to save this RAM data as an ASCII file to Disk.
  12.                 3) Have at least a Hi-Resolution screen of 256 x 192 pixels.
  13.  
  14.         To capture the picture file you want, log onto CIS and goto the page
  15. with the picture. You will be informed that your terminal does not support
  16. the Hi-Res pictures and will be asked if you wish to proceed. You reply YES.
  17.                 1) Just before selecting the menu number for the picture
  18. you want, OPEN your RAM BUFFER.
  19.                 2) Select the picture. You will see meaningless letters and
  20. symbols scroll across your screen.
  21.                 3) When they stop, CLOSE andd SAVE your RAM buffer (in ASCII
  22. format) to Disk.
  23.                 4) Press your <ENTER> key to return to the picture menu.
  24.  
  25. The file you have just saved to disk contains the RLE data required to draw
  26. the image on your screen, all you must now do is decode this data and display
  27. it.
  28.  
  29.         The picture area is a 256 across by 192 down grid. The ASCII value
  30. of each character in the file represents how many dark and how many light
  31. pixels to draw across each line. The data in the file may be thought of as
  32. pairs, as it is sent as DARK LIGHT  DARK LIGHT  DARK LIGHT .......
  33. The actual value of pixels to turn on or off is the ASCII value of the
  34. character minus 32. This is done so that no control codes are sent that might
  35. upset the recieveing computer or network. All picture codes will be in the
  36. range CHR$(32) (ASCII space) to chr$(127) (ASCII del).
  37. This makes the pixel range for one character 0 to 95.
  38.  
  39.         What follows is a plain vanilla basic flow chart that you can
  40. follow to help write a program to display the picture on your computer.
  41.  
  42.  
  43. 1) Open and prepair the previously captured data file for input.
  44. 2) Clear and initalize the Hi-Res Screen of your computer. The upper left most
  45. pixel is to be consitered Line 1 Column 1.
  46. Set a line counter variable = 1. Also set a column variable = 1. (LI=1:CO=1)
  47. 3) GET one charater from the file and test to see if it equal to chr$(27).
  48. (GET#8,X$: IF X$=CHR$(27) then ...... )
  49. This is an ESC code and indicates the begining of the picture data.
  50.         If the character is not a Chr$(27) then loop back to 3).
  51. 4) GET the next character after the ESC. It should equal an ASCII "G".
  52. (GET#8,X$:If X$="G" then ........)
  53. This means Graphics mode. If it is not a "G", either return to 3) or display
  54. an error.
  55. 5) GET the next character after the G, it should be an ASCII "H".
  56. (GET#8,X$:IF X$="H" then ......)
  57. This means High-Res. If it is not, return to 3) or display an error.
  58.  
  59.  
  60. 6) Get the next character. Call it BL$ (Black) Convert it to a value of pixels
  61. by the formula: BP=ASC(BL$)-32 (BlackPixels = ascii value of BL$ minus 32)
  62.     Was the END OF FILE HIT ? If yes then goto 13) (The exit)
  63. Since your screen is already black, it is not required to write black
  64. pixels to the screen, just to update the Line and Column pointers.
  65. You want to add one to the column number for each count of the BP, you also
  66. want to reset this value to 1 and add one to the line count when the column
  67. count equals 257.
  68. Also, should BP = 0 you dont need to do anything here.
  69. 7) If BP = 0  then GOTO 9)
  70. 8) For Z = 1 to BP
  71.    CO = CO + 1       (Column = column + 1)
  72.    If CO = 257 then LI = LI + 1: CO = 1  (Overflow, increase line, reset column)
  73.    Next Z
  74.    If LI=193 then goto 13)  (Was that the last line? If yes, goto exit)
  75. 9) Get the next character, call it WT$ (white) Convert it to the value of white
  76. pixels via: WP=ASC(WT$)-32
  77.     Was the END OF FILE HIT ? If YES GOTO 13) (the exit)
  78. 10) Should the value of WP be 0, dont do anything here, return to get the
  79. next black character. (GOTO 6))
  80. The next loop is almost the same as the black loop, only here we need to
  81. set pixels on.
  82. 11) For Z=1 to WP
  83.     Set LI,CO    (Set the pixel at line LI, column CO)
  84.     CO = CO + 1
  85.     IF CO = 257 then LI = LI + 1: CO = 1
  86.     Next Z
  87.     If LI=193 then goto 13)
  88.     (Was that the last line ? If yes then exit)
  89. 12) GOTO 6)   (Loop back to the next black character)
  90.  
  91.  
  92. 13) The exit.. CLOSE the disk file. 
  93.     Look at the picture on the screen. Set up a loop to wait for a key press
  94. before you reset or clear the screen.
  95.  
  96.  
  97.  
  98.  Different computers will use different syntaxes in their BASICs, but using
  99. the above brief outline, you should be able to write a program to display
  100. the pictures.
  101.  
  102. What follows is part of the information avalible in the Technical files
  103. on the VID-1 pages.
  104.  
  105. *****
  106.     High Resolution Graphics
  107.   <ESC><G><H>
  108.   The screen is cleared to black and high resolution graphics mode (256 x 192
  109. pixels) is entered.  In this mode data is sent as pairs of run length encoded
  110. characters.
  111.   The first character of the pair indicates the number of background pixels. 
  112. The second character indicates the number of foreground pixels.  Each character
  113. of a pair is the actual count plus 32.  The total count + 32 will not exceed
  114. 127, so that the parity bit is to be ignored.
  115.   For example, the ASCII sequence <L><W> indicates 44 background pixels and 55
  116. foreground pixels.  The line drawing also should wrap from the last position on
  117. a line to the first position on the next line.
  118.   Thus, if the last pixel set on a line was in position 250, and a sequence of 0
  119. background and 10 foreground is received, then the last 6 pixels are set on the
  120. next line.
  121. *****
  122.  
  123.  
  124. For more information, try contacting the SYSOP of the SIGs related
  125. to your computer.
  126.  
  127. Note to Commodore 64 users: Avalible in DL2 of the CBIG SIG is the terminal
  128. program CBterm/C64. This program displays the RLE Hi-Res pictures ON LINE
  129. and will even dump them to a Star or Epson printer.
  130. The program is avalible for downloading via VIDTEX or XMODEM, and if you can
  131. not download, you may get a free copy in the mail by reading the file
  132. MAILIN.TXT also in DL2 of CBIG. See the files there for more info.
  133.   -Chrisdos CBIG SYSOP
  134.